Namespace - LJCDBDataAccess
Returns
The result XML message.
Syntax
C# |
private DbResult RetrieveClientSql()
|
Executes a "Retrieve" client SQL statement.
(E)
Remarks
This method is called from the
Execute()
method if the DbRequest.QueryType is "RetrieveSql".
Example
C# |
private static Person RetrieveClientSql(DbDataAccess dbDataAccess
, DbColumns dataDefinition)
{
Person retValue = null;
StringBuilder builder = new StringBuilder(64);
builder.AppendLine("select * from PersonTest");
builder.AppendLine("where Name = 'TestName'");
string sql = builder.ToString();
DbColumns dataColumns = null;
bool isColumnModifications = true;
if (isColumnModifications)
{
List<string> columnNames = new List<string>();
foreach (DbColumn column in dataDefinition)
{
columnNames.Add(column.ColumnName);
}
dataColumns = DbCommon.QueryColumns(columnNames, dataDefinition);
}
DbRequest dbRequest = new DbRequest()
{
ClientSql = sql
Columns = dataColumns,
QueryType = QueryType.RetrieveSQL.ToString(),
TableName = "PersonTest",
};
DbResult dbResult = dbDataAccess.Execute(dbRequest);
if (dbResult != null)
{
string sqlStatement = dbResult.ExecutedSql;
if (dbResult.DbRecords != null && dbResult.DbRecords.Count > 0)
{
retValue = new Person();
DbCommon.SetObjectValues(dbResult.DbRecords[0], retValue);
}
}
return retValue;
}
|